package com.fanyouzhao.ehome2.core.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author: fanyouzhao
 * @Date: 15:34 2021/4/23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "tb_user")
public class User implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Integer id;
    @Column(name = "user_name")
    private String name;
    @Column(name = "user_phone")
    private String phone;
    @Column(name = "user_birth")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date birth;
    @Column(name = "user_sex")
    private String sex;
    @Column(name = "user_regTime")
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date regTime;
    private List<Cp> cpList;
    private Set<Cp> cpSet;
    private Map<String,Cp> cpMap;
    private List<Role> roleList;

    public User(String name, String phone) {
        this.name = name;
        this.phone = phone;
    }

    public User(java.sql.Date regTime) {
        this.regTime = regTime;
    }
}